<?php
/*
Template Name: Front Page (Alternate)
*/

$meta=get_post_custom($post->ID);
$loadgif = '/img/loading.gif';
if(substr(bandit::get_option('theme_style'),0,4)=='dark')
	$loadgif = '/styles/dark/loading.gif';
?>

<?php get_header(); ?>

<?php get_sidebar(); ?>

<div id="right" class="t-front alt">
	
<?php if(isset($meta['_bandit_front_title'][0]) || isset($meta['_bandit_front_subheading'][0])): // INTRO BLOCK ?>
	<div id="introtext">
		<div id="introtext-inner">
			<?php if(isset($meta['_bandit_front_title'][0])) { echo '<h1>'.$meta['_bandit_front_title'][0].'</h1>'; } ?>
			<?php if(isset($meta['_bandit_front_subheading'][0])) { echo '<h2>'.$meta['_bandit_front_subheading'][0].'</h2>'; } ?>
		</div>
		<div class="pike"></div>
	</div>
<?php endif; // END INTRO BLOCK ?>

<?php if(isset($meta['_bandit_slider'][0])): // SLIDER BLOCK ?>
<?php $slider = BanditSliders::get_slider($meta['_bandit_slider'][0]); ?>
	<?php if($slider && isset($slider['items'])): ?>

	<script type="text/javascript">
		jQuery(document).ready(function($){
			$("#slides").slides({
				preload: true,
				preloadImage: '<?php echo get_template_directory_uri().$loadgif; ?>',
				next: '#slide-next',
				prev: '#slide-prev',
				generatePagination: true,
				play: 7000,
				effect: 'fade',
				autoHeight: false,
				hoverPause: true,
				crossfade: true
			});			
		});
	</script>
	
	<div id="front-slider-alt">
		<div id="slides">
			<div id="slide-prev"></div>
			<div id="slide-next"></div>
			<div class="slides_container">
			<?php foreach($slider['items'] as $item): ?>
				<?php $item['image'] = bandit::dynamic_resize($item['image_id'],NULL,678,370,TRUE); ?>
				<div class="item">
					<?php if($item['link']) { echo '<a href="'.$item['link'].'">'; } ?>
					<img src="<?php echo $item['image']['url']; ?>" alt="<?php echo $item['image_alt']; ?>" />
					<?php if($item['caption']) { echo '<span class="caption-bar"><i>'.$item['caption'].'</i></span>'; } ?>
					<?php if($item['link']) { echo '</a>'; } ?>
				</div>
			<?php endforeach; ?>
			</div>
		</div>
	</div>
	<?php endif; ?>
<?php endif; // END SLIDER BLOCK ?>
	
	<div id="subheader">
		<div id="subheader-inner">
			<?php if(isset($meta['_bandit_front_desc'][0])) { echo '<p>'.$meta['_bandit_front_desc'][0].'</p>'; } ?>

<?php if(isset($meta['_bandit_front_button1'][0])): // BUTTON BLOCK ?>
			<div id="intro-links">
				<a class="btn-huge" href="<?php echo $meta['_bandit_front_button_link1'][0]; ?>"><?php echo $meta['_bandit_front_button1'][0]; ?></a>
				<?php if(isset($meta['_bandit_front_button2'][0])) { echo '<a class="btn-huge" href="'.$meta['_bandit_front_button_link2'][0].'">'.$meta['_bandit_front_button2'][0].'</a>'; } ?>
			</div>
<?php endif; // END BUTTON BLOCK ?>
		</div>
	</div>
	
	<div id="content">
		<div id="content-inner">
			<?php if(is_active_sidebar('bandit_front_alt')): ?>
			<div id="content-pad">
				<div id="grid-wrap" class="widget-alt front">
					<?php dynamic_sidebar('bandit_front_alt'); ?>			
				</div><!-- /#grid-wrap -->
				<div class="clear"></div>
			</div><!-- /#content-pad -->
			<?php endif; ?>
			<?php if(isset($meta['_bandit_front_footer_widgets'][0])) { get_template_part('footer-widgets'); } // footer-widgets.php ?>
		</div><!-- /#content-inner -->
		<div class="clear"></div>
	</div><!-- /#content -->
	
</div><!-- /#right -->

<?php get_footer(); ?>
